function DtoProxy() {
    this._proxy = new AjaxProxy();    
}

DtoProxy.prototype = {
    getYearAndTravel: function(year) {
        var yearAndTravelJsonDto = JSON.parse(this._proxy.getYearAndTravel(year));
        return DtoConverter.toYearAndTravelDto(yearAndTravelJsonDto);
    },

    getYearAndTravelAsync: function(year, callback) {
        var me = this;
        this._proxy.getYearAndTravelAsync(year, function(response) {
            var yearAndTravelJsonDto = JSON.parse(response);
            var yearAndTravelDto = DtoConverter.toYearAndTravelDto(yearAndTravelJsonDto);
            callback(yearAndTravelDto);
        });
    },

    saveMonths: function(monthDtos) {
        var monthJsonDtos = monthDtos.select(function(monthDto) {
            return DtoConverter.toMonthJsonDto(monthDto);
        });
        this._proxy.saveMonths(JSON.stringify(monthJsonDtos));
    },

    getTravelSteps: function(year) {
        var travelJsonDtos = JSON.parse(this._proxy.getTravelSteps(year));
        return travelJsonDtos.select(function(travelJsonDto) {
            return DtoConverter.toTravelStepsDto(travelJsonDto);
        });
    },

    saveTravelSteps: function(travelStepDtosToAdd, travelStepsToRemove) {
        var add = travelStepDtosToAdd.select(function(dto) {
            return DtoConverter.toTravelStepsJsonDto(dto);
        });
        this._proxy.saveTravelSteps(JSON.stringify({ add: add, remove: travelStepsToRemove }));
    },
    
    saveLastVisitedMonthAsync: function(firstVisibleYearMonth, selectedYearMonth, callback) {
        this._proxy.saveLastVistedMonthAsync(firstVisibleYearMonth, selectedYearMonth,
                function() {
                    callback();
                });
    }
};